export const toInt = (str: string) => {
  if (typeof str === 'number') return str;
  if (!str) return 0;
  return parseInt(str, 10) || 0;
};

export const removeUndefinedValues = <T>(obj: T): T => {
  const filteredObj: Partial<T> = {} as Partial<T>;
  for (const key in obj) {
    if (obj[key] !== undefined) {
      filteredObj[key] = obj[key];
    }
  }
  return filteredObj as T;
};
